<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>模特经验</title>
    <base href="<?php echo base_url();?>" />
    <link href="style/base.css" rel="stylesheet" type="text/css" />
    <link href="style/common.css" rel="stylesheet" type="text/css" />
    <link href="style/houtai.css" rel="stylesheet" type="text/css" />
    <link href="style/yindao.css" rel="stylesheet" type="text/css" />
    <link href="style/my.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script src="js/organictabs.jquery.js"></script>
    <script type="text/javascript" src="js/Common.js"></script>
    <script type="text/javascript" src="js/Validation.js"></script>
    <script type="text/javascript" src="jscript/WdatePicker.js"></script>
    <script type="text/javascript" src="js/jquery.form.js"></script>
    <script type="text/javascript" src="js/jquery.blockUI.js"></script>
<script type="text/javascript">
$(function(){
	$("#txtActivity").bind("blur",function(){checkExperience("txtActivity","tipA")});
	$("#txtTraining").bind("blur",function(){checkExperience("txtTraining","tipT")});
	$("#txtCompetition").bind("blur",function(){checkExperience("txtCompetition","tipC")});
	$("#txtReward").bind("blur",function(){checkExperience("txtReward","tipR")});	
	loadUserInfo();
	$("#btnNext").bind("click",save);	
});
function loadUserInfo(){
	$.ajax({
		type:"post",
		url:"index.php/login/getUserInfo",
		dataType:"json",
		success:function(data){
			$("#txtActivity").val(data.activitiexperience);
			$("#txtTraining").val(data.trainingexperience);
			$("#txtCompetition").val(data.competitionexperience);
			$("#txtReward").val(data.reward);						
		}
	});
}

function checkExperience(id,tipid){
	var v = $("#"+id).val();
	if(IsEmpty(v)){
		SetError(tipid,"必填项");
		return false;
	}
	var len = v.length;
	if(len<=0 || len>1000){
		SetError(tipid,"最多1000字");
		return false;
	}
	SetOK(tipid);
	return true;
}
function save(){
	if(checkExperience("txtActivity","tipA")==false)
		return;
	if(checkExperience("txtTraining","tipT")==false)
		return;
	if(checkExperience("txtCompetition","tipC")==false)
		return;
	if(checkExperience("txtReward","tipR")==false)
		return;
	
	
	var activity = $("#txtActivity").val();
	var training = $("#txtTraining").val();
	var competition = $("#txtCompetition").val();
	var reward = $("#txtReward").val();

	var params = {
			activity:activity,
			training:training,
			competition:competition,
			reward:reward
			};
	var url = "index.php/login/saveExperience";
	$.ajax({
		type:"post",
		url:url,
		dataType:"json",
		data:params,
		success:function(data){
			if(data.ReturnCode==1){
				if($("#btnNext").attr("src")=="images/bc_inp.jpg"){
					alert('保存成功');
					window.location="<?php echo base_url()?>index.php/manage/experience";
				}
				else{
					window.location="<?php echo base_url()?>index.php/login/card";	
				}				
			}else{
				alert('保存失败');
			}
		}
	});
}
</script>
</head>
<body>
<?php include 'header.php';?>
	<form id="formArchive">

		<!-- 03 开始 -->
		<div class="yindao_k" style="<?php if(isset($ht)) echo "border:0px;";?>">
			<?php
			if (! isset ( $ht )) {
				print "<div class='yindao_bt'>
							<img src='images/yindao_03.jpg' />
						</div>";
			}
			?>
			
			<div class="yindao_3">
				<span>参加活动经历</span><label id="tipA">请注明时间、城市、活动名称</label> <br />
				<textarea id="txtActivity" cols="" style="width: 620px; height: 170px;"
					rows=""></textarea>
			</div>
			<div class="yindao_3">
				<span>专业培训经历</span><label  id="tipT">请注明时间、城市、活动名称 </label><br />
				<textarea id="txtTraining" cols="" style="width: 620px; height: 170px;"
					rows=""></textarea>
			</div>
			<div class="yindao_3">
				<span>参加比赛经历</span><label  id="tipC">请注明时间、城市、活动名称 </label><br />
				<textarea id="txtCompetition" cols="" style="width: 620px; height: 170px;"
					rows=""></textarea>
			</div>
			<div class="yindao_3">
				<span>获奖殊荣</span><label  id="tipR">请注明时间、城市、活动名称</label> <br />
				<textarea id="txtReward" name="" cols="" style="width: 620px; height: 170px;"
					rows=""></textarea>
			</div>

			<?php 
				if(!isset($ht)){
					print "<div class='yindao_inp'>
								<a href='index.php/login/archivet'><img src='images/fhsyb_inp.jpg' /></a>
								<img id='btnNext' class='link' src='images/bcxyb_inp.jpg' />
						   </div>";
				}else{
					print "<div class='filter_inp'>
								<img id='btnNext' class='link' src='images/bc_inp.jpg'>
							</div>";
				}
			?>	


		</div>
		<!-- 03 结束 -->

	</form>

	<!-- 页脚 开始 -->
 <?php include 'footer.php';?>
<!-- 页脚 结束 -->
</body>
</html>
